#include<iostream>
#include"SeqStack.h"
using namespace std;
int main(){
    SeqStack<int> s;
    int num = 0, jinzhi = 0, count;
    int arr[100];
    cout << "请输入一个十进制数:" << endl;
    cin >> num;
    cout << "请输入要转换的进制，例如2,8,16：" << endl;
    cin >> jinzhi;
    if (jinzhi == 2){
        s.push2(num);
        count = s.push2(num);
    }
    if (jinzhi == 8){
        s.push8(num);
        count = s.push8(num);
    }
    if (jinzhi == 16){
        s.push16(num);
        count = s.push16(num);
    }
    cout << "转换结束后对应的进制：" << endl;

    if (jinzhi == 2 || jinzhi == 8){
        for (int i = 1; i <= count; i++){
            cout << s.pop();
        }
    }
    
    if (jinzhi == 16){
    for (int i = 1; i <= count; i++){
        int tmp = s.pop();
        if (tmp >= 10){
            char x = tmp - 10 + 'A';
            cout << x;
        }
        else cout << tmp;
    }
    /* if (jinzhi == 16){ */
    /*     for (int i = 1; i <= count; i++){ */
    /*         arr[i] = s.pop(); */
    /*     } */
    /*     for (int i = 1; i <= count; i++){ */
    /*         if (arr[i] >= 10){ */
    /*             char x = arr[i] - 10 + 'A'; */
    /*             cout << x; */
    /*         } */
    /*         else cout << arr[i]; */
    /*     } */
    }

    cout << endl;
}
